package com.yn.xr.common.properties;

import java.io.IOException;
import java.util.Properties;

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

/**
 * 属性读取service
 * 
 * @author HX1501337 李韩刚
 */
public class HxPropertyConfigurer extends PropertyPlaceholderConfigurer {

	private Properties properties;

	public HxPropertyConfigurer() {
		this.ignoreUnresolvablePlaceholders = true;
	}

	@Override
	protected Properties mergeProperties() throws IOException {
		properties = super.mergeProperties();
		return super.mergeProperties();
	}

	public String getValueByKey(String key) {
		if (properties == null) {
			return "";
		}
		String value = properties.getProperty(key);
		return value == null ? "" : value;
	}
}
